<!-- 审核流程记录 -->
<template>
  <section class="content" id="mhmContent">
    <!-- 表格区 -->
    <div class="table">
      <lq-table ref="registerRecordTableRef"
                :columns="columns"
                :records="registerRecordTableData.records"
                size="default"
                :border="true"
                :stripe="true"
      >
      </lq-table>
    </div>
    <br>
  </section>
</template>

<script setup lang="ts">
/**
 * 全局方法引入
 */
const global = getCurrentInstance().appContext.config.globalProperties;

import {
  ref,
  reactive,
  onMounted,
  toValue,
  inject,
  getCurrentInstance
} from "vue";
import {FormInstance, FormRules, ElMessage, ElMessageBox} from "element-plus";
import lqtableCommon from '../../components/lqtableCommon.js';
import {closeDialogKey, editKey} from '../../components/keys.js';
import LqTable from '@/pages/components/LqTable.vue'

const optCase = inject(editKey);

//================ table =============
const columns = [
  {label: '处理单位', prop: 'orgName', minWidth: 200},
  {label: "处理人", prop: 'userName', minWidth: 80},
  {label: '处理结果', prop: 'result', minWidth: 120},
  {label: "审核意见", prop: 'comment', minWidth: 250},
  {label: "时间", prop: 'registerResultTime', minWidth: 250},
];

const registerRecordTableRef = ref();

const registerRecordTableData = ref({
  records: [],
  tableSize: 'default',
  border: true,
});

const loadData = () => {
  console.log(`加载审核流程记录 Info ID: %s  Hazard Code: %s`,
      optCase.value.hazardInfoId, optCase.value.hazardCode);
  registerRecordTableRef.value?.startLoading();
  global.$api.getMajorHazardRegisterRecords({
    hazardInfoId: optCase.value.hazardInfoId,
    hazardCode: optCase.value.hazardCode
  }).then( ({data}) => {
    if (data.status === 'OK') {
      registerRecordTableRef.value?.stopLoading();
      registerRecordTableData.value.records = data.data;
    }
  });
}

onMounted(() => {
  loadData();
})


</script>

<style scoped>

</style>
